package crud.client.factory.list.grid;

import java.io.Serializable;

import com.google.gwt.user.client.rpc.IsSerializable;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.widgets.grid.ListGridField;

import crud.client.data.Colonne;

public class ToOneListGridFieldFactory implements ListGridFieldFactory, Serializable, IsSerializable
{
	@Override
	public ListGridField newListGridField(Colonne colonne)
	{
		ListGridField colonneField = new ListGridField(colonne.getCodeColonne(), colonne.getLibelle());
		colonneField.setAlign(Alignment.LEFT);
		return colonneField;
	}

	@Override
	public Serializable getValueInRecord(Colonne colonne, Record record)
	{
		return record.getAttribute(colonne.getCodeColonne());
	}

}
